<template>
	<view class="leaveInfo">
		<view class="title">
			我的{{ info.leaveType == 0 ? '事假':'病假' }}申请
		</view>
		<view class="time">
			<view class="start">
				开始时间：{{ info.start }}
			</view>
			<view class="end">
				结束时间：{{ info.end }}
			</view>
		</view>
		<view class="info">
			<view class="initiator">
				发起人：{{ userName }}
			</view>
			<view class="approver">
				审批人：{{ approverName }}
			</view>
		</view>
		<view class="type" :style="{'color': info.type == 0 ? '#67C23A': info.type == 1 ? '#409EFF':'#F56C6C'  }">
			审批状态： {{info.type == 0 ? '审批中': info.type == 1 ? '通过':'驳回'}}
		</view>
	</view>
</template>

<script>
	import { getApprover } from '@/api/leave.js'
	export default {
		data() {
			return {
					info:null,
					userName:null,
					approverName:null
			};
		},
		onLoad(option) {
			this.info = uni.getStorageSync('leaveInfo')
		},
		async created(){
			this.userName = JSON.parse(uni.getStorageSync('userInfo')).name
			const obj = {
				id : this.info.approver_user_id
			}
			const res = await getApprover(obj)
			if(res.status == 0){
				this.approverName = res.data[0].name
			}
		}
	}
</script>

<style lang="less" scoped>
	.leaveInfo{
		padding: 20rpx;
	}
.title{
	width: 100%;
	text-align: left;
	color:red;
	font-size: 48rpx;
}
.time{
	margin-top: 40rpx;
}
.start{
	margin-top: 20rpx;
}
.end{
	margin-top: 20rpx;
}
.initiator{
	margin-top: 20rpx;
}
.approver{
	margin-top: 20rpx;
}
.type{
	margin-top: 20rpx;
}
</style>
